<?php $lesson_arr = array(1=>"一年级",2=>"二年级",3=>"三年级",4=>"四年级",5=>"五年级",6=>"六年级",7=>"初一",8=>"初二",9=>"初三",10=>"高一",11=>"高二",12=>"高三",);?>
<include file="./Application/Home/View/default/public/header.html" title="超老师"/>
<div id="need-list" class="need-list body-margin">
    <div class="container">
        <div class="row">
            <div class="col-md-10 col-md-offset-1">
                <div class="panel panel-default order">
                    <div class="panel-heading">
                        <a class="btn order-filter <?php if ($status != 1){ echo 'active';} ?>" href="/Home/Requirement/index">未接订单</a>
                        <a class="btn order-filter <?php if ($status == 1){ echo 'active';} ?>" href="/Home/Requirement/index/status/1">已接订单</a>
                    </div>
                    <div class="table-responsive" id="order_list">
                        <table class="table panel-body panel-light">
                            <tbody>
                            <tr>
                                <th>订单号</th>
                                <th>订单信息</th>
                                <th>地址</th>
                                <?php
                                    if($_SESSION['type'] == 1){
                                ?>
                                <th>订单操作</th>
                                <?php
                                    }
                                ?>
                            </tr>
                            <?php
                            foreach ($data as $key => $value) {
                            ?>
                            <tr>
                                <td class="status">
                                    <?php echo $value['order_sn']; ?>
                                    <br>
                                    <br>
                                    <?php
                                    if( $value['teacher_id'] != 0){
                                    ?>
                                    <span class="label orientation">指定教员</span>
                                    <br>
                                    <br>
                                    <?php
                                    }
                                    ?>
                                    <span class="text-muted">发布时间:<?php if($value['date']!="0000-00-00"){echo $value['date'];}else{echo '未填写';}; ?></span>
                                </td>

                                <td class="detail">
                                    <p>科目：<?php echo $value['lesson']; ?></p>

                                    <p>年级：<?php echo $lesson_arr[$value['grade']]; ?></p>

                                    <!--<a class="learn-more" type="button" data-toggle="modal" onclick="look_detail(195)">订单详情</a>-->
                                </td>
                                <td class="address">
                                    <p><?php echo preg_replace('/(\d+)/','*',$value['address']); ?></p>
                                </td>
                                <?php
                                    if($_SESSION['type'] == 1){
                                ?>
                                <td class="operations">
                                    <ul class="unstyled button-list list-unstyled">
                                        <?php
                                    if( $value['teacher_id'] != 0){
                                    ?>
                                        <a class="btn btn-primary my-style" disabled="">指定单</a>
                                        <?php
                                    }else{
                                    ?>
                                        <!--a class="btn btn-primary my-style  long_take "data-id ="<?php echo $value['id']; ?>"  >1接单</a-->
                                        <?php } ?>
                                    </ul>
                                </td>
                                <?php
                                    }
                                ?>
                            </tr>
                            <?php
                            }
                        ?>
                            </tbody>
                        </table>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>

<div class="modal order fade" id="moreinfo_orderneed" tabindex="-1" role="dialog" aria-labelledby="myModalLabel"
     aria-hidden="true" style="display: none;">
    <div class="modal-dialog">
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span
                        aria-hidden="true">×</span></button>
                <h4 class="modal-title" id="moreinfo_orderneed">订单详情</h4>
            </div>
            <div class="modal-body">
                <div class="row item">
                    <div class="col-md-12">
                        <p class="title">在校成绩：<span>中等</span></p>

                        <p class="title">孩子的性格：<span></span></p>

                        <p class="title">期望时间：<span>周六下午</span></p>
                    </div>
                    <div class="col-md-12">
                        <p class="title">详细需求：</p>

                        <p class="content">孩子成绩不错，但是生物不及格，生物基础不好，化学希望拔高，孩子态度认真，很努力</p>
                    </div>

                </div>
            </div>
            <div class="modal-footer">
                <button type="button" class="btn btn-default" data-dismiss="modal">关闭</button>
            </div>
        </div>
    </div>
</div>
<div style="display: block">
    <div style="text-align: center">
        {$render}
    </div>
</div>
<script>
    $('.long_take').click(function(){
        var requirement_id = $(this).data("id");
        $.ajax({
                type: "post",
                url: "/Home/Index/makeOrder",
                dataType: 'json',
                data:{
                    requirement_id:requirement_id
                },
                success: function(result) {
                    if ( result.flag == 1) {
                        alert(result.content);
                    } else{
                        alert(result.content);
                    }
                }
            })
    });
</script>

<include file="./Application/Home/View/default/public/footer.html"/>
